<?php
include('../../inc/global.inc');
include("../islogin.php");
$url=$_SERVER['HTTP_REFERER'];
?>
<?php if($_POST[tj]){
@mysql_query("insert into jm_pinpai (member_id,m_user,type_id,j_title,picture) values ('$_POST[member_id]','$_POST[m_user]','$_POST[type_id]','$_POST[j_title]','$_POST[picture]')");
echo "<script>alert('添加成功');location='pinpai.php';</script>";
}

if($_POST[xg]){
@mysql_query("update jm_pinpai set member_id='$_POST[member_id]',m_user='$_POST[m_user]',type_id='$_POST[type_id]',j_title='$_POST[j_title]',picture='$_POST[picture]' where id='".$_POST['iid']."'");
echo "<script>alert('修改成功');location='".$_POST['urls']."'</script>";
}
?>
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
<script type='text/javascript' src="../js/shijian.js"></script>
</HEAD>
<BODY>
<center>
  <table width="50%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">品牌与推荐信息&nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
<?php if($_GET[tj_act]){?>
<TABLE width="50%" border="0" cellpadding="0" cellSpacing="1" bgcolor="#000000">
        <TBODY>
        <form method="post" action="" name="form1">
	 <tr>
        <td align="center" bgcolor="#8DA8CF" colspan="2" height="45">品牌与推荐信息</td>
      </tr>
	 <TR>
            <td width="22%" height="25" align="center" bgcolor="#eff6ff">会员id</td>
            <TD width="78%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="member_id" type="text" size="10" maxlength="20"></TD>
	 </TR>
	 <TR>
            <td width="22%" height="25" align="center" bgcolor="#eff6ff">会员账号</td>
            <TD width="78%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="m_user" type="text" size="20" maxlength="20"></TD>
	 </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">标题</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="j_title" type="text" size="35" maxlength="100"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">分类</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><select name="type_id">
			  <option value="1">推荐</option>
			  <option value="2">品牌</option>
			</select></TD>
          </TR> 
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">图片</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="picture" type="text" id="picture" size="30">
            &nbsp;&nbsp;
	   <input name="button" type="button" onClick="window.open ('../upfile.php', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')" value="上传图片"></TD>
          </TR>		  		  		  
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">&nbsp;</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input type="submit" value=" 提 交 ">
        <INPUT type="hidden" value="ok" name="tj"></TD>
          </TR>
 </form>                
</TABLE>
<?php }?>
<?php
if($_GET[xg_act]){
$sql="select * from jm_pinpai where id=".$_GET['xg_id'];
$rs=mysql_query($sql);
$row=mysql_fetch_array($rs)
?>
<TABLE width="50%" border="0" cellpadding="0" cellSpacing="1" bgcolor="#000000">
        <TBODY>
        <form method="post" action="" name="form1">
          <tr>
        <td align="center" bgcolor="#8DA8CF" colspan="2" height="45">品牌与推荐信息</td>
          </tr> 
          <TR>
            <td width="22%" height="25" align="center" bgcolor="#eff6ff">会员id</td>
            <TD width="78%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="member_id" value="<?=$row[member_id]?>" type="text" size="15" maxlength="20"></TD>
          </TR>
          <TR>
            <td width="22%" height="25" align="center" bgcolor="#eff6ff">会员账号</td>
            <TD width="78%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="m_user" value="<?=$row['m_user']?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">标题</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="j_title" type="text" value="<?=$row[j_title]?>" size="35" maxlength="100"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">分类</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><select name="type_id">
			  <option value="1" <?php if($row[type_id]==1){echo "selected";}?>>推荐</option>
			  <option value="2" <?php if($row[type_id]==2){echo "selected";}?>>品牌</option>
			</select></TD>
          </TR> 
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">图片</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="picture" value="<?=$row[picture]?>" type="text" id="picture" size="30">
            &nbsp;&nbsp;
	   <input name="button" type="button" onClick="window.open ('../upfile.php', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')" value="上传图片"></TD>
          </TR>		  		  		  
          <TR>
            <td width="22%" height="25" align="center" bgcolor="#eff6ff">&nbsp;</td>
            <TD width="78%" bgcolor="#F9F9F9" style="padding-left:4px;"><input type="submit" value=" 提 交 ">
            <input type="hidden" name="iid" value="<?=$row['id']?>"><input type="hidden" name="urls" value="<?=$url?>"><input type="hidden" name="iid" value="<?=$row['id']?>">
        <INPUT type="hidden" value="ok" name="xg"></TD>
          </TR>
 </form>                
</TABLE>
<?php }?>
</center>
</BODY>
</HTML>

